#
# # 列表
# a = [1, 2]
# b = [2, 1]
# print(set(a) == set(b))
# print(set(a))
#
# # 字典
# a = {"conds"}


# 测试问题1 conds中的value无法在question中标注出来
import editdistance
import jieba

sum = 0
question = "环比数低于15的是哪些城市，在上周成交了多少面积"
str1 = "14.84"

def most_similar(w, wlist):
    """从词表中找最相近的词（当无法全匹配的时候）
    """
    if len(wlist) == 0:
        return w
    scores = [editdistance.eval(w, t) for t in wlist]
    return wlist[scores.index(min(scores))]


def most_similar_2(word, sentence):
    """从句子s中找与w最相近的片段，
    借助分词工具和ngram的方式尽量精确地确定边界。
    """
    sw = jieba.lcut(sentence)
    sl = list(sw)
    sl.extend([''.join(i) for i in zip(sw, sw[1:])])
    sl.extend([''.join(i) for i in zip(sw, sw[1:], sw[2:])])
    sl.extend([''.join(i) for i in zip(sw, sw[1:], sw[2:], sw[3:])])
    return most_similar(word, sl)

a = [1, 2, 3]
print(tuple(a))

a = {"agg": [0, 0], "cond_conn_op": 0, "sel": [1, 2], "conds": [[0, 2, "福州"]]}
b = {"agg": [0, 0], "cond_conn_op": 0, "sel": [1, 2], "conds": [[0, 2, "福州"]]}
c = [[4, 0, '10'], [5, 0, '3']]
d = [[5, 0, '3'], [4, 0, '10']]
print(set(c)==set(d))